﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.Data;

namespace WcfService1
{
    // NOTE: If you change the interface name "ISvcSEBanking" here, you must also update the reference to "ISvcSEBanking" in Web.config.
    [ServiceContract]
    public interface IService1
    {
        /// <summary>
        /// Check Assist of accont
        /// </summary>
        /// <param name="UserName">UserName is UserID</param>
        /// <param name="Password">Password of Account</param>
        /// <returns>return the user object with Username, UserID and UserTypeID</returns>
        [OperationContract]
        User CheckAccount(String UserName, String Password);

        [OperationContract]
        decimal GetBalance(String idCard);
        
        /// <summary>
        /// Exchange the money form source card to target card
        /// </summary>
        /// <param name="CardSource">ID of source card</param>
        /// <param name="SecurityCode">Security code number</param>
        /// <param name="CardDisk">ID of target card</param>
        /// <param name="money">The number of money which wanna exchange</param>
        /// <returns>1: Exchange succeeded; 0: the number of money is not match; -1: id of source card do not exist; -2: source card is not enought money; -3: Security code do not match; -4: id of target card do not match</returns>
        [OperationContract]
        int ExChangeVND(String idCardSource, String SecurityCode, String idCardTarget, decimal money);

        /// <summary>
        /// Exchange the money form source card to target card
        /// </summary>
        /// <param name="CardSource">ID of source card</param>
        /// <param name="SecurityCode">Security code number</param>
        /// <param name="CardDisk">ID of target card</param>
        /// <param name="money">The number of money which wanna exchange</param>
        /// <returns>1: Exchange succeeded; 0: the number of money is not match; -1: id of source card do not exist; -2: source card is not enought money; -3: Security code do not match; -4: id of target card do not match</returns>
        [OperationContract]
        int ExChangeUSD(String idCardSource, String SecurityCode, String idCardTarget, decimal money);

        /// <summary>
        /// To sub the money from card
        /// </summary>
        /// <param name="idCard">ID of the card</param>
        /// <param name="money">The number of money is subed</param>
        /// <returns>1: Exchange succeeded; 0: the number of money is not match; -1: id of card do not exist; -2: card is not enought money</returns>
        [OperationContract]
        int Withdraw(String idCard, decimal money);

        /// <summary>
        /// To add the money to card
        /// </summary>
        /// <param name="idCardSource">ID of the card</param>
        /// <param name="money">The number of money is added</param>
        /// <returns>1: Exchange succeeded; 0: the number of money is not match; -1: id of card do not exist;</returns>
        [OperationContract]
        int SendIn(String idCard, decimal money);

        [OperationContract]
        string GetData(int value);

        [OperationContract]
        CompositeType GetDataUsingDataContract(CompositeType composite);


        // TODO: Add your service operations here
    }

    //User Datatype is used when the user log in to system
    [DataContract]
    public class User
    {
        String m_UserName;
        String m_UserID;
        int m_UserTypeID;
        
        [DataMember]
        public String UserName
        {
            get { return m_UserName; }
            set { m_UserName = value; }
        }

        [DataMember]
        public String UserID
        {
            get { return m_UserID; }
            set { m_UserID = value; }
        }
        
        [DataMember]
        public int UserTypeID
        {
            get { return m_UserTypeID; }
            set { m_UserTypeID = value; }
        }
    }
    // Use a data contract as illustrated in the sample below to add composite types to service operations.
    [DataContract]
    public class CompositeType
    {
        bool boolValue = true;
        string stringValue = "Hello ";

        [DataMember]
        public bool BoolValue
        {
            get { return boolValue; }
            set { boolValue = value; }
        }

        [DataMember]
        public string StringValue
        {
            get { return stringValue; }
            set { stringValue = value; }
        }
    }
}
